<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String basePath = request.getScheme() + "://" + request.getServerName()
			+ ":" + request.getServerPort() + request.getContextPath();
%>
<jsp:include page="/WEB-INF/page/auth/_header.jsp"></jsp:include>
<body>
	<jsp:include page="/WEB-INF/page/auth/header.jsp"></jsp:include>
	<div id="middle">
		<jsp:include page="/WEB-INF/page/auth/menu.jsp"></jsp:include>
		<div id="right">
		    <div class="p10">
			    <form id="teacher_infoForm" class="easyui-form" method="post" data-options="novalidate:true">
			    	<table cellpadding="4">
			    		<tr>
			    			<td width="10%">姓名</td>
			    			<td width="40%"><input class="easyui-textbox" type="text" name="name" value="${detail.name }" data-options="required:true"></input></td>
			    			<td width="10%">年级号</td>
			    			<td width="40%"><input class="easyui-combobox" name="grade" value="${detail.grade }" data-options="
							url:'<%=basePath %>/gradeCombo',
							method:'get',
							panelHeight:'auto'"></td>
			    		</tr>
			    		<tr>
			    			<td>任教学科:</td>
			    			<td><input class="easyui-combobox" name="subjectId" value="${detail.subjectId }" data-options="
							url:'<%=basePath %>/subjectCombo',
							method:'get',
							panelHeight:'auto'"></td>
			    			<td>身份证号</td>
			    			<td><input class="easyui-textbox" type="text" name="idNo" value="${detail.idNo }" data-options="required:true"></td>
			    		</tr>
			    		<tr>
			    			<td>手机号</td>
			    			<td><input class="easyui-numberbox" name="mobile" value="${detail.mobile }" data-options="required:true"></td>
			    			<td>登录密码</td>
			    			<td><input class="easyui-passwordbox" name="password" value="${detail.password }" required></td>
			    		</tr>
			    		<tr>
			    			<td>性别</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="sex" id="sex" required>
			    				<option value="">请选择</option>
			    				<option value="1">男</option>
			    				<option value="2">女</option>
			    			</select></td>
			    			<td>出生日期</td>
			    			<td><input class="easyui-datebox" name="birthday" value="${detail.birthday }"></td>
			    		</tr>
			    		<tr>
			    			<td>职称</td>
			    			<td><input class="easyui-textbox" type="text" name="techTitle" value="${detail.techTitle }"></input></td>
			    			<td>籍贯</td>
			    			<td><input class="form-control1" name="nativePlace" id="nativePlace" value="${detail.nativePlace }"></td>
			    		</tr>
			    		<tr>
			    			<td>民族</td>
			    			<td><select class="easyui-combobox" style="width: 150px;" name="nation" id="nation"></select></td>
			    			<td>政治面貌</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="geopolitical" id="geopolitical">
			    				<option value="">请选择</option>
			    				<option value="男">群众</option>
			    				<option value="女">共产党员</option>
			    				<option value="女">共青团员</option>
			    				<option value="女">其它</option>
			    			</select></td>
			    		</tr>
			    		<tr>
			    			<td>居住地址</td>
			    			<td colspan="3"><input class="form-control1" name="liveAddr" id="liveAddr"> <input class="form-control1" name="liveAddrDesc" id="liveAddrDesc" style="width:250px;" placeholder="请输入居住详细地址（具体到门牌）"></td>
			    		</tr>
			    		<tr>
			    			<td>入党团时间</td>
			    			<td><input class="easyui-datebox" name="partyDate" value="${detail.partyDate }"></td>
			    			<td>户口性质</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="homeNature" id="homeNature">
			    				<option value="">请选择</option>
			    				<option value="农业">农业</option>
			    				<option value="非农业">非农业</option>
			    			</select></td>
			    		</tr>
			    		<tr>
			    			<td>婚姻状况</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="isMarry" id="isMarry">
			    				<option value="">请选择</option>
			    				<option value="已婚">已婚</option>
			    				<option value="未婚">未婚</option>
			    				<option value="离婚">离婚</option>
			    			</select></td>
			    			<td>毕业参加工作时间</td>
			    			<td><input class="easyui-datebox" name="workDate" value="${detail.workDate }"></td>
			    		</tr>
			    		<tr>
			    			<td>大学专业</td>
			    			<td><input class="easyui-textbox" type="text" name="schoolMajor" value="${detail.schoolMajor }"></input></td>
			    			<td>是否正编教师</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="isOrganTeacher" id="isOrganTeacher">
			    				<option value="">请选择</option>
			    				<option value="是">是</option>
			    				<option value="否">否</option>
			    			</select></td>
			    		</tr>
			    		<tr>
			    			<td>是否有普通话证</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="isChineseCard" id="isChineseCard">
			    				<option value="">请选择</option>
			    				<option value="是">是</option>
			    				<option value="否">否</option>
			    			</select></td>
			    			<td>是否具备心理ABC证</td>
			    			<td><select style="width: 150px;" class="easyui-combobox" name="isPsychologyAbc" id="isPsychologyAbc">
			    				<option value="">请选择</option>
			    				<option value="是">是</option>
			    				<option value="否">否</option>
			    			</select></td>
			    		</tr>
			    		<tr>
			    			<td>其他获得资格证书</td>
			    			<td><input class="easyui-textbox" name="otherQualification" value="${detail.otherQualification }" data-options="multiline:true" style="height:60px"></input></td>
			    			<td>曾获得荣誉</td>
			    			<td><input class="easyui-textbox" name="hadHonor" value="${detail.hadHonor }" data-options="multiline:true" style="height:60px"></input></td>
			    		</tr>
			    		<tr>
			    			<td colspan="4">
			    				<div class="mt20 tnc">
							    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">确认提交</a>
							    </div>
			    			</td>
			    		</tr>
			    	</table>
			    </form>
			</div>
		</div>
	</div>
	<jsp:include page="/WEB-INF/page/auth/_footer.jsp"/>
	<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/weuix.min.css"/>
	<script src="<%=basePath %>/js/zepto.min.js" type="text/javascript"></script>
	<script src="<%=basePath %>/js/picker.js" type="text/javascript"></script>
    <script src="<%=basePath %>/js/picker-city.js" type="text/javascript"></script>
    <script src="<%=basePath %>/js/select.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function(){
			$('#sex').combobox("setValue", "${detail.sex}");
			$('#nation').combobox("setValue", "${detail.nation}");
			$('#geopolitical').combobox("setValue", "${detail.geopolitical}");
			$('#homeNature').combobox("setValue", "${detail.homeNature}");
			$('#isMarry').combobox("setValue", "${detail.isMarry}");
			$('#isOrganTeacher').combobox("setValue", "${detail.isOrganTeacher}");
			$('#isChineseCard').combobox("setValue", "${detail.isChineseCard}");
			$('#isPsychologyAbc').combobox("setValue", "${detail.isPsychologyAbc}");
		})
		initLiveAddr("${detail.liveAddr}")
		$("#nativePlace").cityPicker({
	        title: "请选择省市区"
	    });
	    $("#liveAddr").cityPicker({
	        title: "请选择省市区"
	    });
	    initNation("teacher_info");
	    function initLiveAddr(v) {
			if(!v) return;
			var array = v.split(",");
			$("#liveAddr").val(array[0]);
			$("#liveAddrDesc").val(array[1]);
		}
		function submitForm() {
			var data = $.serializeObject($("#teacher_infoForm"));
			if(!data.name) {
				$.messager.alert('提醒','姓名不能为空','info');
				return false;
			}
			else if(!data.idNo) {
				$.messager.alert('提醒','姓名不能为空','info');
				return false;
			}
			else if(!data.password) {
				$.messager.alert('提醒','登录密码不能为空','info');
				return false;
			}
			else if(!data.sex) {
				$.messager.alert('提醒','请选择性别','info');
				return false;
			}
			else if(!data.mobile) {
				$.messager.alert('提醒','联系不能为空','info');
				return false;
			}
			if(data.liveAddr && data.liveAddrDesc) {
				data.liveAddr += "," + data.liveAddrDesc;
			}else {
				if(data.liveAddr || data.liveAddrDesc) {
					$.messager.alert('提醒','居住地址填写完整','info');
					return false;
				}
			}
			$.ajax({
				url: basePath + "/sys/teacher/my/update",
				type: 'POST',
				data: data
			}).done(function(data) {
				if(data.code=='000'){
				    $.messager.show({title:'操作提示', msg:"提交成功"});
				}
			}).fail(function() {
				$('#msg').html('error,发生错误请及时联系管理员!');
			});
		}
	</script>
</body>
</html>